import request from '@/utils/request'

// 获取用户详细信息
export function getInfo(query) {
	return request({
	  url: '/app_api/customer/info',
	  method: 'get'
	})
}
// 获取用户地址
export function customerAddr() {
  return request({
    url: '/app_api/customer-addr/list',
    method: 'get'
  })
}
// 获取销售
export function salesman() {
  return request({
    url: '/app_api/salesman/list',
    method: 'get'
  })
}
// 获取用户会员
export function customer(query) {
  return request({
    url: '/app_api/customer/list',
    method: 'get',
		params: query
  })
}
// 绑定推广码
export function customerSpread(query) {
  return request({
    url: `/app_api/customer/spread/${query.code}`,
    method: 'get'
  })
}
// 获取用户订单数量
export function orderTotal(query) {
  return request({
    url: '/app_api/order/total',
    method: 'get',
		params: query
  })
}
// 获取用户收藏
export function collection(query) {
  return request({
    url: '/app_api/product/collection/list',
    method: 'get',
		params: query
  })
}
// 获取取消收藏
export function delCollection(query) {
  return request({
    url: '/app_api/product/collection/delete',
    method: 'get',
		params: query
  })
}
// 获取用户常购
export function oftenBuy(query) {
  return request({
    url: '/app_api/often-buy/list',
    method: 'get',
		params: query
  })
}
// 获取取消常购
export function delOftenBuy(query) {
  return request({
    url: `/app_api/often-buy/${query.id}`,
    method: 'get'
  })
}
// 获取常购收藏
export function oftenBuyCollection(query) {
  return request({
    url: query.type === 1 ? '/app_api/product/collection/list' : '/app_api/often-buy/list',
    method: 'get'
  })
}
// 获取用户优惠券数量
export function couponNumber(query) {
  return request({
    url: '/app_api/coupon/all-coupon-number',
    method: 'get',
		params: query
  })
}
// 获取用户地址
export function addressList(query) {
  return request({
    url: '/app_api/customer-addr/list',
    method: 'get',
		params: query
  })
}
// 新增编辑地址
export function editAddress(data) {
  return request({
    url: `/app_api/customer-addr/${data.id?'update':'add'}`,
    method: 'post',
		data: data
  })
}
// 设置默认地址
export function defaultAddress(data) {
  return request({
    url: `/app_api/customer-addr/setDefault/${data.id}`,
    method: 'put'
  })
}
// 删除地址
export function delAddress(data) {
  return request({
    url: `/app_api/customer-addr/delete/${data.id}`,
    method: 'delete'
  })
}
// 对账管理
export function capital(query) {
  return request({
    url: '/app_api/capital/list',
    method: 'get',
		params: query
  })
}
// 店铺信息
export function perfectInfo(query) {
  return request({
    url: '/app_api/customer/perfect-default-info',
    method: 'get',
		params: query
  })
}
// 编辑店铺信息
export function perfectEdit(data) {
  return request({
    url: `/app_api/customer/perfect-info`,
    method: 'post',
  	data: data
  })
}
// 修改头像
export function updateHeard(query) {
  return request({
    url: `/app_api/customer/update-heard`,
    method: 'get',
  	params: query
  })
}
// 修改用户信息
export function updateLoginInfo(data) {
  return request({
    url: `/app_api/customer/update-login-info`,
    method: 'post',
  	data: data
  })
}
// 新增反馈
export function adviceAdd(data) {
  return request({
    url: `/app_api/advice/add`,
    method: 'post',
  	data: data
  })
}
// 反馈查询
export function adviceList(data) {
  return request({
    url: `/app_api/advice/list/${data.type}`,
    method: 'post',
  	data: data
  })
}
// 积分商品
export function couponProductShopList(query) {
  return request({
    url: `/app_api/coupon-product/shop-list`,
    method: 'get',
  	params: query
  })
}
// 积分兑换
export function couponProductBuy(query) {
  return request({
    url: `/app_api/coupon-product/buy/${query.id}`,
    method: 'get'
  })
}
// 积分明细
export function integralList(query) {
  return request({
    url: `/app_api/integral/detail/list`,
    method: 'get',
  	params: query
  })
}
// 签到
export function signIn(query) {
  return request({
    url: `/app_api/integral/detail/sign-in`,
    method: 'get'
  })
}
// 我的优惠券
export function couponSelf(query) {
  return request({
    url: `/app_api/coupon/self`,
    method: 'get',
  	params: query
  })
}
// 我的商品优惠券
export function couponProductSelf(query) {
  return request({
    url: `/app_api/coupon-product/self`,
    method: 'get',
  	params: query
  })
}
// 领券中心
export function couponReceiveList(query) {
  return request({
    url: `/app_api/coupon/receive-list`,
    method: 'get',
  	params: query
  })
}
// 领商品券中心
export function couponProductReceiveList(query) {
  return request({
    url: `/app_api/coupon-product/receive-list/${query.regionCode}`,
    method: 'get'
  })
}
// 领取优惠券
export function couponGetOne(query) {
  return request({
    url: `/app_api/coupon/get-One/${query.id}`,
    method: 'get'
  })
}
